class Solution {
public:
    int hammingWeight(int n) {
        int a = (n&((~n) + 1));
        int count = 0;
        while (a > 0)
        {
            count++;
            n = n & (n - 1);
            a = (n & ((~n) + 1));
        }
        return count;
    }
};

int main()
{
    Solution s;
    s.hammingWeight(11);
    return 0;
}